/**
 * @author Lion
 * @date 2017年1月24日 下午12:02:35
 * @qq 439635374
 */
package com.pointlion.sys.mobile.nowsee;

import java.util.List;

import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.pointlion.sys.mvc.base.BaseController;

/***
 * @author Administrator
 *
 */
public class MobileNowSeeController extends BaseController {
	
	/***
	 * 获取列表
	 */
	public void getList(){
		String pid = getPara("pid");
		String sql = "select * from sys_org n ";
		if(StrKit.isBlank(pid)){
			sql = sql + "where n.parent_Id='#root'";
		}else{
			sql = sql + "where n.parent_Id='"+pid+"'";
		}
		sql =sql + " order by sort";
		List<Record> orgList = Db.find(sql);
		if(orgList!=null&&orgList.size()>0){//有孩子
			renderSuccess(orgList,"查询成功");
		}else{
			renderSuccess(Db.find("select * from cms_now_see n where n.parent_Id='"+pid+"'"),"查询成功");
		}
	}
}
